package client_gui;

import java.awt.BorderLayout;

import javax.swing.JPanel;


/**
 * Klasa predstavlja panel logovanog korisnika. Objekat ove klase je jedan od dva moguca
 * osnovna panela klijent aplikacije (drugi je InitialPanel).
 * LoggedPanel u sebi sadrzi tri panela:
 * 1. InfoPanel
 * 2. ContactsPanel
 * 3. ShortcutPanel
 * 
 * @author UrosKrkic & Radivoje Popovic
 */
public class LoggedPanel extends JPanel {
	
	/**
	 * Vlasnik - glavni prozor aplikacije.
	 */
	private ClientWindow owner;
	
	
	// !!! Paneli koje u sebi sadrzi LoggedPanel.
	private InfoPanel infoPanel = null;
	private ContactsPanel contactsPanel = null;
	private ShortcutPanel shortcutPanel = null;
	
	
	
	/**
	 * Konstruktor.
	 * @param owner - glavni prozor aplikacije
	 * @author UrosKrkic & Radivoje Popovic
	 */
	public LoggedPanel(ClientWindow owner) {
		this.owner = owner;
		
		infoPanel = new InfoPanel(this.owner);
		contactsPanel = new ContactsPanel(this.owner);
		shortcutPanel = new ShortcutPanel(this.owner);
		
		initializeLoggedPanel();
	}

	
	/**
	 * Metod vrsi inicijalizaciju LoggedPanel-a.
	 * @author UrosKrkic & Radivoje Popovic
	 */
	private void initializeLoggedPanel() {
		this.setLayout(new BorderLayout());
		
		this.add(infoPanel, BorderLayout.NORTH);
		this.add(contactsPanel, BorderLayout.CENTER);
		this.add(shortcutPanel, BorderLayout.SOUTH);
	}

	
	
	/**
	 * Metod vraca referencu na ovaj panel.
	 * @return - contactsPanel referenca
	 * @author UrosKrkic & Radivoje Popovic
	 */
	public ContactsPanel getContactsPanel() {
		return this.contactsPanel;
	}
	
	
	/**
	 * Metod postavlja avatar.
	 * @param avatar - novi avatar
	 * @author UrosKrkic & Radivoje Popovic
	 */
	public void setAvatar(String avatar) {
		infoPanel.setAvatar(avatar);
	}
	
	
	/**
	 * Metod postavlja nickname.
	 * @param nickname - novi nickname
	 * @author UrosKrkic & Radivoje Popovic
	 */
	public void setNickname(String nickname) {
		infoPanel.setNickname(nickname);
	}
	
	
	/**
	 * Metod postavlja status.
	 * @param status - novi status
	 * @author UrosKrkic & Radivoje Popovic
	 */
	public void setStatus(int status) {
		infoPanel.setStatus(status);
	}
	
}
